#include "Color.h"
#include <cmath>

Color::Color(double red, double green, double blue)
    : red_(red),
      green_(green),
      blue_(blue) {}

Color::Color(int32_t rgb) : red_(0), green_(0), blue_(0) {
  red_ = ((rgb >> 16) & 0xFF) / 255.0;
  green_ = ((rgb >> 8) & 0xFF) / 255.0;
  blue_ = (rgb & 0xFF) / 255.0;
}

Color Color::operator+(const Color& rhs) const {
  return Color(red_ + rhs.red_, green_ + rhs.green_, blue_ + rhs.blue_);
}

Color operator*(double k, const Color& color) {
  return Color(k * color.red(), k * color.green(), k * color.blue());
}

